package com.visi.babytunredis.controller;

import com.visi.babytunredis.entity.Goods;
import com.visi.babytunredis.service.GoodsService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/test")
public class TestCacheController {
    Logger logger = LoggerFactory.getLogger(TestCacheController.class);
    @Resource
    private GoodsService goodsService;
    @GetMapping("/test")
    public String getTest(long id){
        Goods goods =goodsService.getGoods(id);
        if(goods!=null){
            return goods.toString();
        }else{
            return "对应的商品["+id+"]不存在";
        }

    }
}
